export const WithdrawalOrderStatus = [
  {
    id: 0,
    name: '全部',
    color: 'green',
    options: true,
  },
  {
    id: 1,
    name: '申请中',
    color: 'green',
    options: true,
  },
  {
    id: 2,
    name: '已取消',
    color: 'grey',
    options: true,
  },
  {
    id: 3,
    name: '申请异常',
    color: 'orange',
    options: false,
  },
  {
    id: 4,
    name: '已完成',
    color: 'black',
    options: true,
  },
  {
    id: 5,
    name: '已拒绝',
    color: 'red',
    options: true,
  },
];

export const WithdrawalOrderStatusOptions = WithdrawalOrderStatus.filter((o) => o.options).map(
  (o) => ({
    id: o.id,
    name: o.name,
    color: o.color,
  }),
);

export const WithdrawalOrderStatusParse = {
  parse: (code?: number) => {
    const obj = WithdrawalOrderStatusOptions.find((o) => o.id === code) || WithdrawalOrderStatus[0];
    return { ...obj };
  },
};
